/**
*@Author      ：anlzou
*@Date        ：10:06 2021/4/23
*@Github      ：https://github.com/anlzou
*@Description ：
*/
package com.anlzou.cr_threads4method;

import java.util.concurrent.Callable;

public class Cr_CallableAndFutureTask implements Callable {
    public Object call() throws Exception {
        // 此线程执行需要执行的操作声明在call中
        int sum = 0;
        for (int i = 0; i <= 100; i++) {
            sum += i;
        }
        System.out.println("我是新线程 implements Callable and use FutureTask");
        return sum;// int类型赋值给Object,自动装箱
    }
}
